package com.rzico.order.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum WarehouseTypeEnum {
    /**
     * 出入库单据类型(1.采购入库,2.采购退货,3.调拨入库,4.销售出库,5.销售退货,6.调拨出库,7.盘点损益,8.其他出库)
     */
    WAREHOUSE_TYPE_PURCHASE_IN(1, "采购入库"),
    WAREHOUSE_TYPE_PURCHASE_OUT(2, "采购退货"),
    WAREHOUSE_TYPE_ALLOCATE_IN(3, "调拨入库"),
    WAREHOUSE_TYPE_SALE_OUT(4, "销售出库"),
    WAREHOUSE_TYPE_SALE_IN(5, "销售退货"),
    WAREHOUSE_TYPE_ALLOCATE_OUT(6, "调拨出库"),
    WAREHOUSE_TYPE_CHECK_OUT(7, "盘点损益"),
    WAREHOUSE_TYPE_OTHER_OUT(8, "其他出库");


    private Integer id;
    private String name;

    WarehouseTypeEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        WarehouseTypeEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static WarehouseTypeEnum getById(Integer id) {
        for (WarehouseTypeEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

}
